package server.business.chat.config;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.poi.ss.usermodel.Workbook;

import server.ServerConfigCache;
import server.business.shop.config.ShopConfig;
import server.utils.AppFile;

import com.core.config.GameModel;
import com.core.config.ILoader;
import com.core.utils.ExcelUtils;

public class InformationConfigLoader implements ILoader {

	private static final String excelName = "shop.xls";

	@Override
	public void load() {
		Workbook wb = ExcelUtils.loadExcel(AppFile.getExcelConfig(excelName));
		List<InformationConfig> itemList = new ArrayList<InformationConfig>();
		GameModel.initModels(wb.getSheetAt(0), InformationConfig.class, itemList);
		ServerConfigCache.informationMap = new ConcurrentHashMap<Integer, InformationConfig>();
		GameModel.listToMap(itemList, ServerConfigCache.informationMap, "id");
	}

}
